# -*- coding: utf-8 -*-

from .img import *


class Gif(Img):
    __FORMAT__ = 'gif'
    __MAGIC__ = bytearray(b'GIF')

    @classmethod
    def size(cls, fobj):
        rb = fobj.read(10)
        w = int.from_bytes(rb[-4:-2], byteorder='little')
        h = int.from_bytes(rb[-2:], byteorder='little')

        return ImgSize(fobj.file_size, w, h)
